
#ifndef __WORLD_H
#define __WORLD_H

#include <iostream>
#include "vector4.h"
#include "matrix44.h"
#include "body.h"
#include "joint.h"
#include "particle.h"
#include "particlefactory.h"

#include <GL/glut.h>
#include <GL/gl.h>
class World
{
// Member Functions
public:
	World(void);
	void draw(Vector4 *camPos, Vector4 *camRot);
	void update(float etime);

	int addBody(Body *newBody);
	bool removeBody(Body *newBody);

	int addJoint(Joint *newJoint);
	bool removeJoint(Body *newBody);
	
	void addParticleEmitter(ParticleFactory *pf);
	
	bool checkParticleAgainstBodies(Particle *p);

	Body *getBody(int id);
	Joint *getJoint(int id);
	void drawFloor();
protected:
	
private:
	int bodyID;
	int jointID;
	int maxWorldObjects;
	int numBodies;
	int numJoints;
	int maxParticles;
	int numParticles;
	int numpEmitters;

// Member Variables
public:
	Vector4 **floorVertices;
	Body  *bodies[100];
	Joint *joints[100];
	Particle *particles[64000];
	ParticleFactory *pEmitters[16];
protected:
private:
};

#endif //__WORLD_H
